<?php
/**
 *
 * Lang class. Loads all languages from folders included in directory
 * automatically. If language is incomplete, it users Google Translate
 * API to load the missing language text as oer the prefix
 * @author Paul
 *
 */
class lang{
	function doGoogle($API_KEY){
		$url = 'https://ajax.googleapis.com/ajax/services/language/translate?' +
       'v=1.0&q=tHello,%20my%20friend!&langpair=en%7Ces&key='.$API_KEY.'&userip=INSERT-USER-IP';

		// sendRequest
		// note how referer is set manually
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_REFERER, /* Enter the URL of your site here */);
		$body = curl_exec($ch);
		curl_close($ch);

		// now, process the JSON string
		$json = json_decode($body);
		// now have some fun with the results...
	}
}
?>